package ch.zhaw.skuh.turing.view;

import java.awt.Panel;

import javax.swing.BoxLayout;
import javax.swing.JScrollPane;

import ch.zhaw.skuh.turing.model.turingmaschine.TuringChar;

public class OutputPanel extends Panel {

	private MaschinePanel maschinePanel;
	private MaschineRulePanel maschineRulePanel;
	private MaschineDetailPanel maschineDetailPanel;

	private static final long serialVersionUID = -1040693702854540374L;

	public OutputPanel(TuringChar tc) {
		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

		this.maschinePanel = new MaschinePanel(tc);
		this.maschineRulePanel = new MaschineRulePanel(tc);
		this.maschineDetailPanel = new MaschineDetailPanel(tc);

		add(this.maschinePanel);
		add(this.maschineDetailPanel);

		maschineRulePanel.setPreferredSize(maschineRulePanel.getMinimumSize());

		JScrollPane scrollPane = new JScrollPane(maschineRulePanel,
				JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
				JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		add(scrollPane);

	}

	public void update(long time) {
		maschinePanel.update();
		maschineRulePanel.update();
		maschineDetailPanel.update(time);
	}
}
